package com.dycong.common.dataStructuresAndAlgorithms.hash;

import java.util.LinkedList;

/**
 * Created by dycong on 2016/11/26.
 */
public class TestLinkedList {

    public void test(){
        /**
         * todo 标准库的LinkedList是双向链表，以下是其的几个迭代器
         */
        LinkedList linkedList=new LinkedList();
        linkedList.iterator();  //迭代器
        linkedList.descendingIterator();  //迭代器:Adapter to provide descending iterators via ListItr.previous
        linkedList.listIterator();//迭代器
        linkedList.listIterator(5);//指定开始位置的迭代器
    }

    /**
     * @see 标准库LinkedList的Node
     * @param <E>
     */
    private static class Node<E> {
        E item;
        Node<E> next;
        Node<E> prev;

        Node(Node<E> prev, E element, Node<E> next) {
            this.item = element;
            this.next = next;
            this.prev = prev;
        }
    }
}
